<?php
/**
 * The SIDN EPP Contact Handle Object
 *
 * This will hold the complete contact info SIDN can receive and give you
 *
 *
 *
 * @author Ralph de Boom <php5-sidnepp@mijndomein.nl>
 * @author Peter Keizer <php5-sidnepp@mijndomein.nl>
 * @license http://www.gnu.org/licenses/gpl-3.0.txt GNU Public License v3
 * @copyright http://www.mijndomein.nl/
 * @version 0.5
 * @link http://php5-sidnepp.svn.sourceforge.net/viewvc/php5-sidnepp/trunk/dev/docs/index.html
 * @see http://php5-sidnepp.svn.sourceforge.net/viewvc/php5-sidnepp/trunk/dev/docs/php5-sidnepp/SidnContact.html
 * @package php5-sidnepp

 */

class SidnContact
{
	const CONTACT_TYPE_REGISTRANT	= 'reg';
	const CONTACT_TYPE_ADMIN		= 'admin';
	const CONTACT_TYPE_TECH			= 'tech';
	/**
	 * @var string
	 */
	private $contactHandle;
	/**	 
	 * @var SidnContactInfo
	 */
	private $contactInfo;
	/**
	 *
	 * @var string
	 */
	private $contactType;
	/**
	 *
	 * @param string $contactHandle
	 * @param SidnContactInfo $contactInfo
	 * @param string $contactType
	 * @return void
	 */
	public function  __construct($contactHandle, SidnContactInfo $contactInfo = null, $contactType = null)
	{
		$this->setContactHandle($contactHandle);
		if ($contactInfo)
		{
			$this->setContactInfo($contactInfo);
		}
		if ($contactType)
		{
			$this->setContactType($contactType);
		}
	}
	/**
	 * Sets the contact info
	 * @param SidnContactInfo $contactInfo
	 */
	public function setContactInfo(SidnContactInfo $contactInfo)
	{
		$this->contactInfo = $contactInfo;
	}
	/**
	 * Gets the contact info
	 * @return SidnContactInfo
	 */
	public function getContactInfo()
	{
		return $this->contactInfo;
	}
	/**
	 * Sets the contact handle
	 * @param string $contactHandle
	 * @return void
	 */
	public function setContactHandle($contactHandle)
	{
		if (!strlen($contactHandle))
		{
			$contactHandle = 'none';
		}
		$this->contactHandle = $contactHandle;
	}
	/**
	 * Gets the contact handle
	 * @return string
	 */
	public function getContactType()
	{
		return $this->contactType;
	}
	/**
	 * Sets the contact type
	 * @param string $contactType
	 * @return void
	 */
	public function setContactType($contactType)
	{
		$this->contactType = $contactType;
	}
	/**
	 * Gets the contact type
	 * @return string
	 */
	public function getContactHandle()
	{
		return $this->contactHandle;
	}
	/**
	 * Gets the xml notation for this object
	 * @return string
	 */
	public function toXml()
	{
		$xml = '<contact:id>'.$this->getContactHandle().'</contact:id>';
		return $xml;
	}

}


